package xiyuan.keywords.tfidf;

public class KeyWord implements Comparable<KeyWord> {
	private String word;
	private double value;
	
	public KeyWord(String word, double value){
		this.word = word;
		this.value = value;
	}
	
	@Override
	public int compareTo(KeyWord o) {
		double diff = this.getValue() - o.getValue();
		if (diff < 0)
			diff--;
		if (diff > 0)
			diff++;
		return (int) diff;
	}

	public void setWord(String word) {
		this.word = word;
	}

	public String getWord() {
		return word;
	}

	public void setValue(double value) {
		this.value = value;
	}

	public double getValue() {
		return value;
	}

	public String toString(){
		return word + ":" + value;
	}
}
